<?php

namespace Controller\Ajax;

class Article extends Base {

	public function del() {
		$id = $this->getInt('id');
		if (!$id) {
			$this->responseError('参数错误');
		}
		\Data\Article::instance()
			->where(array('ArticleId' => $id))
			->update(
			array('Status' => 0)
		);
		$this->response(true);
	}

	public function delCategory() {
		$id = $this->getInt('id');
		if (!$id) {
			$this->responseError('参数错误');
		}
		$ids = \Data\Category::instance()->getIdsByPid($id);
		if ($ids) {
			\Data\Category::instance()
				->where(array('CategoryId in' => $ids))
				->del();
		}
		$this->response(true);
	}
}